package com.banciyuan.wallpaper.page;

import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.banciyuan.wallpaper.R;
import com.banciyuan.wallpaper.base.BaseActivity;
import com.banciyuan.wallpaper.util.ScreenShots;

/**
 * Created by squall on 2016/8/1.
 */
public class DownLoadActivity extends BaseActivity {

    private ImageView mBackContainer;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_download);
        OnInitUI();
    }

    @Override
    protected void OnInitUI() {
        mBackContainer = (ImageView) findViewById(R.id.back_container);
        mBackContainer.setImageBitmap(BitmapFactory.decodeFile(ScreenShots.IMAGE_TEMP_URI + ScreenShots.IMAGE_FILE_NAME));
        findViewById(R.id.back_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        findViewById(R.id.download_tv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    gotoDownLoad();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(R.anim.umeng_socialize_fade_in, R.anim.umeng_socialize_fade_out);
    }

    private void gotoDownLoad() {
        String url = "http://bcy.net/static/app";
        Uri uri = Uri.parse(url);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
}
